package com.qf.hospital.controller;

import com.qf.hospital.service.DoctorService;
import com.qf.hospital.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author zjw
 * @description 首页逻辑的Controller
 * @date 2021/10/19 15:58
 */
@RestController
public class MainController {

    @Autowired
    private DoctorService doctorService;

    @Autowired
    private ReportService reportService;

    /**
     * 首页排班信息
     * @param week  星期几？
     * @return
     */
    @PostMapping("/main/paiban/{week}")
    public List<Map<String,Object>> scheduler(@PathVariable String week){
        //1. 调用Service查询指定星期的排班信息
        List<Map<String,Object>> result =  doctorService.findSchedulerByWeek(week);

        //2. 返回数据
        return result;
    }


    /**
     * 门诊总人数
     * @return
     */
    @PostMapping("/main/Total")
    public Integer reportTotal(){
        //1. 调用Service查询总门诊人数
        Integer count = reportService.findReportCountTotal();
        //2. 响应
        return count;
    }

    /**
     * 今日门诊总人数
     * @return
     */
    @PostMapping("/main/currentNum")
    public Integer reportCurrent(){
        //1. 调用Service查询总门诊人数
        Integer count = reportService.findReportCountCurrent();
        //2. 响应
        return count;
    }

}
